//
//  User.m
//  RetainCount
//
//  Created by liuxiang on 2017/12/1.
//  Copyright © 2017年 liuxiang. All rights reserved.
//

#import "User.h"


@interface User ()


@end

@implementation User

- (instancetype) initWithDict:(NSDictionary *)dict {
    self = [super init];
    if (self) {
        _age = [dict objectForKey:@"age"];
        _height = [[dict objectForKey:@"height"] floatValue];
        _name = [[dict objectForKey:@"name"] length] == 0 ? nil:[dict objectForKey:@"name"] ;
        _array = [NSArray array];
        _responder = [[UIResponder alloc] init];
    }
    return self;
}

- (NSString *) newDesc {
    return [NSString stringWithFormat:@"this is new Desc %@ = <%p> name = <%@>",NSStringFromClass([self class]),self,self.name];
}

- (id) valueForUndefinedKey:(NSString *)key {
    NSLog(@"valueForUndefinedKey => <%@>",key);
    return nil;
}

+ (BOOL) accessInstanceVariablesDirectly {
    return YES;
}

@end
